Advances in computer graphics allow for the display of three-dimensional graphical objects (e.g., characters in a video game) in a two-dimensional space (e.g., a computer screen or monitor). Video games and other applications that use three-dimensional graphics appear very lifelike to a user, and add to the user's enjoyment of the experience. One technique for generating three-dimensional graphics includes the use of textures. A texture is a two-dimensional bitmap typically used to simulate real world texture detail (e.g., wood, grain, carpet, etc.) when drawing otherwise flat geometry in a three-dimensional rendering of a scene. In some cases, the texture is made up of multiple two-dimensional pixels. Each pixel has the properties of position, color, brightness, and depth. Once created, the texture can be used for rendering images of many types, including images representing text or symbols. Using textures for rendering two-dimensional text is generally desirable over other text-rendering techniques because textures allow the text to be easily projected, scaled, and rotated as appropriate.
Because video games do not market well unless they are visually impressive, it is desirable to have multiple attractive fonts used in one scene. Accordingly, a single texture for use in text rendering in an application (e.g., a three-dimensional video game) may include a large set of glyphs (e.g., the text characters, symbols, and/or images that go along with a certain font or text style). In some cases, the glyphs may be individually colored or may be white characters with a black outline, a black drop-shadow, and/or anti-aliasing effects. Outline and drop-shadow features typically improve readability on a low-resolution display (e.g., a television), especially in cases where background colors do not provide much contrast. Anti-aliasing reduces the stair-stepped effect of pixel-generated lines, and includes using gray or lightly colored pixels near the outline of a glyph. FIG. 1 shows an example of a glyph 102 with anti-aliasing, outlining, and drop-shadow features. To incorporate such features, each pixel in a texture bitmap is typically 32 bits, with eight bits for each color channel (e.g., red, green, blue) and eight bits for an alpha channel that is used as a transparency factor. In most cases, a moderately sized set of glyphs can fit into a 256×256 texture bitmap. FIG. 1 also shows an example of a 512×256 texture bitmap 104.
Text rendering from a texture typically involves selecting a set of texture coordinates that match where a desired glyph resides in the texture (e.g., the coordinates that make up the letter “G”). In more complex systems, built-in support for fonts and similar text-rendering solutions simplify text rendering at the application end. However, such built-in solutions are not always available in the context of video games. For example, current generation video game consoles do not have built-in support for fonts. Likewise, games developed for personal computers typically require higher performance text-rendering solutions than what is typically provided by the personal computer's operating system.
For these reasons, today's video games often provide their own text-rendering support. There are two primary methods for text rendering in video games. In a first method, the CPU of the computer or console writes bits directly onto a render target. While this technique allows text to be rendered with industry standard True Type font files, there are numerous crippling disadvantages relating to high memory usage and performance. For example, since not all video game consoles have enough memory to devote to such potentially large font files, the CPUs often resort to caching the files, which further hurts run-time performance. Furthermore, most CPUs are poorly suited for rendering bitmaps. For example, a typical CPU renders fonts 100 to 1000 times slower than a graphics processing unit (GPU).
The second method is to store the font as a bitmapped texture and render individual glyphs as screen-space aligned quads (e.g., using a GPU's texture rasterizer). This technique uses native functionality of the GPU to render bitmap-based fonts at a full fill rate (measured in pixels per second) of the hardware associated with the GPU. One limitation of this technique is that, when employed with large character sets (e.g., the Unicode character set), it may require texture sizes that exceed current hardware capabilities and use large amounts of memory.
The problems with current text-rendering techniques are exacerbated when creating video games for international markets. For example, a game including Chinese text may require around 5000-8000 glyphs. If each glyph were pre-rendered into a 20×20 pixel section of a texture bitmap, then the entire texture bitmap would be 1800×1800 pixels, or 3.24 MPixels. Because most game consoles support only a limited amount of texture formats, the minimum space requirement when using an 8-bit-per-pixel texture is 3.24 MB. With a 16-bit-per-pixel texture (four bits for each red, green, blue, and alpha channel) the minimum space requirement is 6.48 MB. Because a typical video game console has only about 32-64 MB of physical memory and about 26-58 MB of usable memory, it is unreasonable to devote this much memory to text and fonts.